<template>
    <div>
        <img
            class="login-img"
            src="../assets/login-bg.jpg"
            @click="goLogin"
        />
    </div>
</template>

<script>
export default {
    created () {
        if (this.$getUrlKey('token')) {
            window.localStorage.setItem('token', this.$getUrlKey('token'))
            this.$router.push(window.localStorage.getItem('beforeLoginUrl'))
        }
        else {
            this.$request({
                url: '/api/Login/web_wx_login',
                method: 'post',
                params: {
                    id: window.sessionStorage.getItem('id'),
                    pc: window.sessionStorage.getItem('pc')
                }
            }).then(res => {
                window.location.href = res
            })
        }
    },
    methods: {
        goLogin () {
            this.$request({
                url: '/api/Login/web_wx_login',
                method: 'post',
                params: {
                    id: window.sessionStorage.getItem('id'),
                    pc: window.sessionStorage.getItem('pc')
                }
            }).then(res => {
                window.location.href = res
            })
        }
    }
}
</script>

<style lang="less" scoped>
.login-img {
    display: block;
    width: 100%;
}
</style>